﻿
  <%@ Page Language="C#"MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="ACM_GENERATE_ACCOUNT_Auto.aspx.cs" Inherits="KPIS.GERP.GAMS.APP.App_UI.Forms.ACM_GENERATE_ACCOUNT_Auto" %>

<asp:Content ID="Content2" runat="server" contentplaceholderid="head">
    <title>สร้างรายการบัญชีอัตโนมัติ</title>
    <link href="../CssClass.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" src="../Scripts/DatePicker.js" type="text/jscript"></script>
</asp:Content>
<asp:Content ID="Body" runat="server" contentplaceholderid="ContentPlaceHolder1" >
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="Panel1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="Panel1" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <%--<asp:Panel ID="Panel1" runat="server">--%>
        <div class="DivControl" style="color: #FFFFFF; font-size: large; font-weight: bold;">
            &nbsp;&nbsp;&nbsp;&nbsp;สร้างรายการบัญชีอัตโนมัติ
        </div>
        <div class="DivBody">
            <table>
                <tr>
                    <td>
                        แหล่งเงิน :
                    </td>
                    <td colspan="3">
                        <telerik:RadComboBox ID="ddlBgmSourceSeq" runat="server"
                            DataTextField="bgm_source_name" DataValueField="bgm_source_seq"
                            Filter="Contains" Width="300px">
                        </telerik:RadComboBox>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td colspan="3">
                        <asp:RadioButtonList ID="rblTranType" runat="server" RepeatDirection="Horizontal" Width="800px">
                            <asp:ListItem Text="-- ทั้งหมด --" Value="" Selected="True"></asp:ListItem>
                            <asp:ListItem Text="ตรวจรับ(DN)" Value="icm_delivery_note"></asp:ListItem>
                            <asp:ListItem Text="รอเบิก(RQ)" Value="fim_money_requests"></asp:ListItem>
                            <asp:ListItem Text="จ่ายเงิน(PQ)" Value="fim_payments"></asp:ListItem>
                            <asp:ListItem Text="รับเงิน(RC)" Value="fim_receives"></asp:ListItem>
                            <asp:ListItem Text="ชดใช้เงินยืม(CL)" Value="fim_money_returns"></asp:ListItem>
                            <asp:ListItem Text="ฝาก/ถอน/โอน(TF)" Value="fim_transfers"></asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td>
                        ตั้งแต่รหัสที่
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtStartRefNo" runat="server"></telerik:RadTextBox>
                    </td>
                    <td>
                        ถึงรหัสที่
                    </td>
                    <td>
                        <telerik:RadTextBox ID="txtEndRefNo" runat="server"></telerik:RadTextBox>
                    </td>
                </tr>
                <tr>
                    <td>
                    </td>
                    <td colspan="3">
                        <telerik:RadButton ID="cmdFilter" runat="server" OnClick="cmdFilter_Click" Text="กรองข้อมูล"></telerik:RadButton>
                        <telerik:RadButton ID="cmdPrint" runat="server" OnClick="cmdPrint_Click" Text="พิมพ์รายงาน"></telerik:RadButton>
                    </td>
                </tr>
            </table>
            <asp:Label ID="lblResult" runat="server" ForeColor="Red" />
        </div>
    <asp:Panel ID="Panel1" runat="server">
        <div>
            <telerik:RadGrid GroupingSettings-CaseSensitive="false" ID="grdACMAccountAuto" runat="server" AutoGenerateColumns="false"
                AllowMultiRowEdit="false" AllowMultiRowSelection="true" ShowStatusBar="true" AllowSorting="true"
                Width="998px" AllowPaging="true" AllowFilteringByColumn="true"
                GroupingSettings-GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;"
                GroupingSettings-GroupContinuedFormatString=""
                GroupingSettings-GroupContinuesFormatString=""
                GroupingSettings-GroupSplitFormat=""
                OnItemCommand="grdACMAccountAuto_ItemCommand"
                OnDetailTableDataBind="RadGrid1_DetailTableDataBind">
                <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" GroupLoadMode="Client" Width="100%" ShowFooter="true"
                    DataKeyNames="ref_type" NoMasterRecordsText="< ไม่มีข้อมูล >" GroupsDefaultExpanded="true">
                    <DetailTables>
                        <telerik:GridTableView Width="100%" runat="server" ShowFooter="true" AllowPaging="false" AllowFilteringByColumn="false"
                            Caption="รายละเอียด">
                            <CommandItemSettings ExportToPdfText="Export to PDF" />
                            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                            </RowIndicatorColumn>
                            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                            </ExpandCollapseColumn>
                            <Columns>
                                <telerik:GridBoundColumn DataField="ref_type" UniqueName="ref_type" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="ref_seq" UniqueName="ref_seq" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="account_seq" UniqueName="account_seq" Visible="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="dr_or_cr" FilterControlWidth="100%" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" HeaderText="เดบิต/เครดิต" ShowFilterIcon="false" UniqueName="dr_or_cr" Visible="false">
                                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="100px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="account_code" FilterControlWidth="100%" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="150px" HeaderText="รหัสบัญชี" ShowFilterIcon="false" UniqueName="account_code">
                                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="150px" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="account_name" FilterControlWidth="100%" FooterStyle-HorizontalAlign="Right" FooterText="รวม :" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderText="ชื่อบัญชี" ShowFilterIcon="false" UniqueName="account_name">
                                    <FooterStyle HorizontalAlign="Right" />
                                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn Aggregate="Sum" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="amount_dr" DataFormatString="{0:n2}" FilterControlWidth="100%" FooterStyle-HorizontalAlign="Right" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="150px" HeaderText="Dr" ItemStyle-HorizontalAlign="Right" ShowFilterIcon="false" UniqueName="amount_dr">
                                    <FooterStyle HorizontalAlign="Right" />
                                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="150px" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn Aggregate="Sum" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="amount_cr" DataFormatString="{0:n2}" FilterControlWidth="100%" FooterStyle-HorizontalAlign="Right" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="150px" HeaderText="Cr" ItemStyle-HorizontalAlign="Right" ShowFilterIcon="false" UniqueName="amount_cr">
                                    <FooterStyle HorizontalAlign="Right" />
                                    <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="150px" />
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                            </Columns>
                            <EditFormSettings>
                                <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                </EditColumn>
                            </EditFormSettings>
                        </telerik:GridTableView>
                    </DetailTables>
                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column" Visible="True">
                    </RowIndicatorColumn>
                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column" Visible="True">
                    </ExpandCollapseColumn>
                    <Columns>
                        <telerik:GridClientSelectColumn HeaderStyle-Width="35px" UniqueName="ClientSelectColumn">
                            <HeaderStyle Width="35px" />
                        </telerik:GridClientSelectColumn>
                        <telerik:GridBoundColumn DataField="bgm_year" UniqueName="bgm_year" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="ref_type" FilterControlWidth="100%" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderText="ref_type" ShowFilterIcon="false" UniqueName="ref_type" Visible="false">
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="ref_seq" FilterControlWidth="100%" HeaderText="ref_seq" ShowFilterIcon="false" UniqueName="ref_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="tran_seq" FilterControlWidth="100%" HeaderText="tran_seq" ShowFilterIcon="false" UniqueName="tran_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="tran_type" FilterControlWidth="100%" HeaderText="tran_type" ShowFilterIcon="false" UniqueName="tran_type" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="work_area_seq" FilterControlWidth="100%" HeaderText="work_area_seq" ShowFilterIcon="false" UniqueName="work_area_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="bgm_source_seq" FilterControlWidth="100%" HeaderText="bgm_source_seq" ShowFilterIcon="false" UniqueName="bgm_source_seq" Visible="false">
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="ref_no" FilterControlWidth="100%" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" HeaderText="เลขที่อ้างอิง" ShowFilterIcon="false" UniqueName="ref_no">
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="100px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="tran_date" DataFormatString="{0:D}" FilterControlWidth="100%" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="120px" HeaderText="วันที่ทำรายการ" ShowFilterIcon="false" UniqueName="tran_date">
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="120px" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="tran_name" FilterControlWidth="100%" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderText="ชื่อรายการ" ShowFilterIcon="false" UniqueName="tran_name">
                            <%--HeaderStyle-Width="200px"--%>
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" />
                        </telerik:GridBoundColumn>
                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" DataField="amount" FilterControlWidth="100%" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-Width="100px" HeaderText="จำนวนเงิน" ShowFilterIcon="false" UniqueName="amount" Aggregate="Sum" DataFormatString="{0:n2}">
                            <HeaderStyle Font-Bold="True" HorizontalAlign="Center" Width="120px" />
                            <FooterStyle HorizontalAlign="Right" />
                            <ItemStyle HorizontalAlign="Right" />
                        </telerik:GridBoundColumn>
                    </Columns>
                    <EditFormSettings>
                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                        </EditColumn>
                    </EditFormSettings>
                    <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" 
                        FirstPageToolTip="กลับหน้าแรก" LastPageToolTip="ไปหน้าสุดท้าย" 
                        NextPagesToolTip="หน้าถัดไป" NextPageToolTip="หน้าถัดไป" 
                        PrevPagesToolTip="ย้อนกลับ" PrevPageToolTip="ย้อนกลับ" />
                </MasterTableView>
                <GroupingSettings GroupByFieldsSeparator="&nbsp;&nbsp;&nbsp;&nbsp;" 
                    GroupContinuedFormatString="" GroupContinuesFormatString="" 
                    GroupSplitFormat="" />
                <ClientSettings EnableRowHoverStyle="True" EnablePostBackOnRowClick="false">
                    <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />
                    <Scrolling AllowScroll="true" UseStaticHeaders="true" />
                </ClientSettings>
                <FilterMenu EnableImageSprites="False">
                </FilterMenu>
            </telerik:RadGrid> 
        </div>
        <div class="DivInfo" align="center">
            <asp:LinkButton ID="btnSave" runat="server" CssClass="LinkButton" onclick="btnSave_Click" CausesValidation="true">บันทึกบัญชี
            </asp:LinkButton>
        </div>
    </asp:Panel>
</asp:Content>